package com.example.demoserver.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demoserver.entity.InteGateway;
import com.example.demoserver.service.InteGatewayService;
import com.example.demoserver.mapper.InteGatewayMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 18364
* @description 针对表【inte_gateway】的数据库操作Service实现
* @createDate 2024-02-27 10:08:53
*/
@Service
public class InteGatewayServiceImpl extends ServiceImpl<InteGatewayMapper, InteGateway>
    implements InteGatewayService{
    @Autowired
    InteGatewayMapper inteGatewayMapper;

    @Override
    public List<InteGateway> selectAll() {
        List<InteGateway> list=inteGatewayMapper.selectList(null);
        return list;
    }

    @Override
    public Integer deleteById(Integer id) {
        Integer bol=inteGatewayMapper.deleteById(id);
        return bol;
    }

    @Override
    public InteGateway selectById(Integer id) {
        InteGateway i=inteGatewayMapper.selectById(id);
        return i;
    }

    @Override
    public InteGateway selectByGatewayId(String gatewayId) {
        QueryWrapper<InteGateway> queryWrapper=new QueryWrapper<InteGateway>();
        queryWrapper.eq("gatewayid",gatewayId);
        InteGateway i=inteGatewayMapper.selectByGatewayId(gatewayId);
        return i;
    }

    @Override
    public InteGateway selectByGIdAndPas(String username, String password) {
        QueryWrapper<InteGateway> queryWrapper=new QueryWrapper<InteGateway>();
        queryWrapper.eq("gatewayid",username);
        queryWrapper.eq("mqttpassword",password);
        InteGateway i=inteGatewayMapper.selectOne(queryWrapper);
        return i;
    }
}




